<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Admin extends CI_Controller {

 function __construct()
 {
   parent::__construct();
   $this->load->helper(array('form', 'url'));
 }

 function index()
 {
	$data['login']=$this->session->userdata('logged_in');
   	$this->load->view('admin/admin_home',$data);
 }
 function selectUser()
 {
	$data['user'] = $this->User->getUser();
	$this->load->view('admin/admin_select',$data);
	 
	//$this->load->view('admin/admin_add');
 }
 function test1(){
	 echo 'fff';
 }
 function test2(){
	 echo 'uuu';
 }
 function addUser(){
	 $this->load->view('admin/admin_add');
 }
 
 function addDataUser(){

		
		$this->load->model("User");
		
		$this->User->setUsername($this->input->post('username'));
		$this->User->setPassword($this->input->post('password'));
		$this->User->setName($this->input->post('name'));
		$this->User->setLastname($this->input->post('lastname'));
		$this->User->setStatus($this->input->post('status'));
		
		$this->User->addUser();
		$this->selectUser();
	}
	
	
function deleteDataUser($id){
		
		$this->User->setId($id);

		$this->User->deleteUser();
		
	}
}
?>

